package org.come.mouslisten;

import come.tool.JDialog.TiShiChuLi;
import come.tool.JDialog.TiShiUtil;
import org.come.Frame.OptionsJframe;
import org.come.Frame.TestpackJframe;
import org.come.Frame.ZhuFrame;
import org.come.entity.LotteryGood;
import org.come.until.LotteryFromServerUntil;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import static come.tool.JDialog.TiShiUtil.DoLottery;

public class LotteryGoodslisten implements MouseListener {
    private int goodPlace;// 物品的位置
    //public static List<String> list = new ArrayList<>();
    public LotteryGoodslisten(int goodPlace) {
        super();
        this.goodPlace = goodPlace;
    }

    @Override
    public void mouseClicked(MouseEvent e) {

    }


    @Override
    public void mousePressed(MouseEvent e) {
        if( LotteryFromServerUntil.getRecord()<=0){
            TiShiChuLi chuLi = TiShiUtil.tishiMap.get(DoLottery);
            chuLi.tipBox(true, this.goodPlace);
        }else{
            int pay = 0;
            int num = LotteryFromServerUntil.getRecord();
            switch(num){
                case 1:
                    pay = 3000;
                    break;
                case 2:
                    pay = 5000;
                    break;
                case 3:
                    pay = 5000;
                    break;
                case 4:
                    pay = 5000;
                    break;
                case 5:
                    pay = 5000;
                    break;
                case 6:
                    pay = 10000;
                    break;
                case 7:
                    pay = 20000;
                    break;
                case 8:
                    pay = 40000;
                    break;
            }
            //水墨
            OptionsJframe.getOptionsJframe().getOptionsJpanel().showBox(DoLottery, this.goodPlace,"#W确定要花费#G"+pay+"#W仙玉来打开打开这张卡片吗?");
        }
    }

    @Override
    public void mouseReleased(MouseEvent e) {
    }


    @Override
    public void mouseEntered(MouseEvent e) {
        if(LotteryFromServerUntil.getGoodslist()!=null && LotteryFromServerUntil.getGoodslist().size()>0){
            LotteryGood goodstable = LotteryFromServerUntil.getGoodslist().get(goodPlace);
            if (goodstable != null && goodstable.getLotterystep() != 1) {
                TestpackJframe.getTestpackJframe().getJpac().PaintingText(goodPlace);
                ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
            }
        }
    }

    @Override
    public void mouseExited(MouseEvent e) {
        TestpackJframe.getTestpackJframe().getJpac().ClearText();
        ZhuFrame.getZhuJpanel().cleargoodtext();
    }

}

